import { useValidateStore } from '@/store/useValidateStore'
import { createFileRoute, Outlet, useLocation } from '@tanstack/react-router'
import { useEffect } from 'react'

export const Route = createFileRoute('/auth')({
  component: RouteComponent
})

function RouteComponent() {
  const match = useLocation()
  const resetError = useValidateStore((s) => s.resetErrors)
  useEffect(() => {
    resetError()
  }, [match.pathname, resetError])
  return <Outlet />
}
